﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ModuleInfo_Manage.aspx.cs" Inherits="Catering.Catering_Page.system.ModuleInfo_Manage" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <link href="../../Style/center.css" rel="stylesheet" type="text/css" />
    <link href="../../Style/zhezhao.css" rel="stylesheet" type="text/css" />
    <script src="../../Style/zhezhao.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <style type="text/css">
        *{margin:0px; padding:0px;}
        .search_title{background-color:#e5f1ff; border:1px solid #c2def6;margin-top:10px;}
        .main{margin-top:10px;}
        .table_title{ background:url(../../Images/table_th_bg.gif) repeat-x 0px 0px;height:32px;}
        .Page{width:300px;margin:10px auto 0px auto;}
        body{ font-size:12px;}
        .table_120 td{padding:5px 0px;}
    </style>
    <script type="text/javascript">
        //添加模块
        function Module_Add() {
            $("#btn_Add").show();
            $("#btn_Edit").hide();
            $("#txt_name").val("");
            $("#txt_back").val("");
            divshow("Module_main", "bg");
        }

        //修改模块
        function Module_Edit(uid) {

            $("#HidRid").val(uid);
            $.ajax({
                type: "Post",
                url: "ModuleInfo_Manage.aspx/GetModule",
                data: "{'uid':'" + uid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#txt_name").val(data.d[0]);
                    $("#txt_back").val(data.d[1]);
                    $("#btn_Add").hide();
                    $("#btn_Edit").show();
                    divshow("Module_main", "bg");
                }
            });
        }

        //删除模块
        function Module_Del(uid) {

            if (!confirm("确认删除?")) {
                return;
            }

            $.ajax({
                type: "Post",
                url: "ModuleInfo_Manage.aspx/DelModule",
                data: "{'uid':'" + uid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("删除成功！");
                        window.location = 'ModuleInfo_Manage.aspx?cid=' + $("#HidCid").val();
                    }
                }
            });

        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:HiddenField ID="HidRid" runat="server" />
    <asp:HiddenField ID="HidCid" runat="server" />
    <div class="layout">
    <%if (Catering.Toolss.IsVerification(Session["RoleID"].ToString(), "System_power.aspx", "系统模块操作"))
      { %>
        <div class="search_title">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td  align="right"><input id="btn_ModuleAdd" class="input_btn_a" value="添加功能" onclick="Module_Add()"/></td>
                </tr>
            </table>
        </div>
        <%} %>
        <div class="main">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="swxx_table">
                <thead>
                    <tr>
                        <td>功能名称</td>
                        <td>描述</td>
                        <td>编辑</td>
                        <td>删除</td>
                    </tr>
                </thead>
                <tbody>
                    <asp:Repeater ID="Rep_Personnel" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td><%#Eval("operating")%></td>
                                <td><%#Eval("Back")%>&nbsp;</td>
                                <%if (Catering.Toolss.IsVerification(Session["RoleID"].ToString(), "System_power.aspx", "系统模块操作"))
                                  { %>
                                <td align="center"><img src="../../../Images/file.gif" style="cursor: pointer;" onclick="Module_Edit('<%#Eval("id")%>')" /></td>
                                <td align="center"><img src="../../../Images/trash.gif" style="cursor: pointer;" onclick="Module_Del('<%#Eval("id")%>')" /></td>
                                <%}
                                  else
                                  { %>
                                 <td>&nbsp;</td><td>&nbsp;</td>
                                <%  } %>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
        </div>
        <div class="Page">
            <webdiyer:aspnetpager id="AspNetPager1" runat="server" pagesize="10" onpagechanging="AspNetPager1_PageChanging"
             firstpagetext="首页" lastpagetext="尾页" nextpagetext="下一页" prevpagetext="上一页" showpageindex="true">
            </webdiyer:aspnetpager>
        </div>
    </div>
    <!--遮罩-->
    <div id="bg" class="bg"></div>
    <div id="Module_main" class="center_div table_120" style="margin-top:-100px;padding:10px 10px;width:230px;">
        <table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
            <tbody>
                <tr>
                    <td style="width:60px;">功能名称：</td>
                    <td><asp:TextBox ID="txt_name" runat="server" CssClass="input_bg"></asp:TextBox></td>
                </tr>
                <tr>
                    <td style="width:60px;">功能描述：</td>
                    <td><asp:TextBox ID="txt_back" runat="server" CssClass="input_bg"></asp:TextBox></td>
                </tr>
            </tbody>
        </table>
        <table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
            <tr>
                <td align="right">
                        <asp:Button ID="btn_Add" runat="server" OnClick="btn_Add_Click" Text="提交"  CssClass="input_btn_a" />
                        <asp:Button ID="btn_Edit" runat="server" OnClick="btn_Edit_Click" Text="提交" CssClass="input_btn_a" />
                    </td>
                    <td align="left">
                        <input type="button" id="btn_quxiao" onclick='divhidel("Module_main", "bg")' value="取消" class="input_btn_a" />
                    </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>